<?php
		$this->heading->getItem();
		$class = new courseInstance($this->ci);
		$tmpActDate = $this->heading->getActivationDate();
		$tmpExpDate = $this->heading->getExpirationDate();
		$heading_activation_date = empty($tmpActDate) ? $class->getActivationDate() : $this->heading->getActivationDate();
		$heading_expiration_date = empty($tmpExpDate) ? $class->getExpirationDate() : $this->heading->getExpirationDate();
		
		
		if ($this->heading->getSortOrder() == 0 || $this->heading->getSortOrder() == null)
			$currentSortOrder = "Not Yet Specified";
		else
			$currentSortOrder = $this->heading->getSortOrder();
?>
		<form action="index.php" method="post" name="editHeading">
		
			<input type="hidden" name="cmd" value="processHeading">
			<input type="hidden" name="nextAction" value="editClass">
			<input type="hidden" name="ci" value="<?php print($this->ci);?>">
			<input type="hidden" name="headingID" value="<?php print($this->heading->itemID); ?>">
			<input type="hidden" name="reserveID" value="<?php print($this->heading->getReserveID()); ?>">
			
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr>
				<td colspan="2" align="right"><strong><a href="index.php?cmd=editClass&ci=<?php print($this->ci); ?>">Cancel and return to class</a></strong></td>	
			</tr>
			<tr>
				<td colspan="2">
					<div class="helperText" style="align:left; padding:8px 0 20px 0; margin-right:180px;">
					Headings help organize your list of materials into topics or weeks. Headings can stand alone, 
					or you can add items to them. To add an item to a heading (like you would to a folder), go to the Edit Class
					screen, check the items to add to the heading, and scroll to the bottom of your list of materials.
					Select which heading to add the materials to and click the "Submit" button.
					</div>
				</td>
			</tr>
			<tr>
				<td class="headingCell1" width="25%" align="center">HEADING DETAILS</td>
				<td width="75%" align="center">&nbsp;</td>
			</tr>
		    <tr>
		    	<td colspan="2" class="borders">
			    	<table width="100%" border="0" cellspacing="0" cellpadding="5">
			    		<tr>
			    			<td width="30%" bgcolor="#CCCCCC" align="right" class="strong">
			    				<font color="#FF0000">*</font>&nbsp;Heading Title:
			    			</td>
			    			<td>
			    				<input name="heading" type="text" size="60" value="<?php print($this->heading->item->getTitle()); ?>" />
			    			</td>
			    		</tr>
			    		<tr>
			    			<td bgcolor="#CCCCCC" align="right" class="strong">
			    				Current Sort Position:
			    			</td>
	        				<td>
	        					<?php print($currentSortOrder); ?>
	        				</td>			    		
			    		</tr>
			    		<tr>
			    			<td bgcolor="#CCCCCC" align="right" class="strong">
			    				Active Dates:
			    			</td>
			    			<td>
			    				From:&nbsp;<input type="text" id="reserve_activation_date" name="reserve_activation_date" size="10" maxlength="10" value="<?php print($heading_activation_date); ?>" /> <?php print($this->calendar->getWidgetAndTrigger('reserve_activation_date', $heading_activation_date)); ?>
								To:&nbsp;<input type="text" id="reserve_expiration_date" name="reserve_expiration_date" size="10" maxlength="10" value="<?php print($heading_expiration_date); ?>" />  <?php print($this->calendar->getWidgetAndTrigger('reserve_expiration_date', $heading_expiration_date)); ?>
			    			</td>
			    		
			    		</tr>
			    		
<?php
		//notes - only deal with notes if editing a heading (as opposed to creating)
		if($this->heading->getReserveID()){		
			//display edit notes
			$notes = $this->heading->getNotes(true);
			$this->getDisplayer()->displayEditNotes($notes, 'headingID='.$this->heading->getReserveID().'&amp;ci=' . $this->ci);
			
			//display "Add Note" button
?>
						<tr>
							<td colspan="2" bgcolor="#CCCCCC" align="center" class="borders" style="border-left:0px; border-bottom:0px; border-right:0px;">
								<?php $this->getDisplayer()->displayAddNoteButton('reserveID=' . $this->heading->getReserveID()); ?>
							</td>
						</tr>
<?php	} ?>
					
					</table>
					
				</div>
        		</td>
      		</tr>
      		<tr>
      			<td colspan="2" align="center">
      				<br />
      				<input type="submit" name="submit" value="Save Heading" />
				</td>
      		</tr>
    	</table>
    	</form>
